<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class Health extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;

    protected $guarded = [];
    protected $table = 'health';

    /**
     * yuql
     * 查询一条科普信息
     * @param $query
     * @return mixed
     */
    public static function healthOne($query){
        return self::where($query)->first();
    }

    /**
     * yuql
     * 科普列表 model
     * @return Health[]|\Illuminate\Database\Eloquent\Collection
     */
    public static function index(){
        return self::all();
    }

    /**
     * yuql
     * 科普添加 model
     * @param $query
     * @return mixed
     */
    public static function healthAdd($query){
        return self::create($query);
    }

    /**
     * yuql
     * 科普修改 model
     * @param $id
     * @param $query
     * @return mixed
     */
    public static function healthUpdate($id,$query){
        return self::where($id)->first()->update($query);
    }

    /**
     * yuql
     * 科普删除 model
     * @param $id
     * @return int
     */
    public static function healthDel($id)
    {
        return self::destroy($id);
    }

    /**
     * yuql
     * 科普详情 model
     * @param $query
     * @return mixed
     */
    public static function healthDetail($query){
        return self::where($query)->first();
    }

}
